package com.xhs.controller;

import com.xhs.message.ReturnResult;
import com.xhs.service.SignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @desc: 生成签名
 * @projectName: java-tools-parent
 * @author: xhs
 * @date: 2023-8-27 027 16:03
 * @version: JDK 1.8
 */
@Slf4j
@RestController
public class SignController {

    @Resource
    private SignService signService;

    /**
     * 生成签名 参数拼接到url后面
     *
     * @param paramsMap 参数
     * @return ReturnResult<Object>
     */
    @PostMapping("/signGet")
    public ReturnResult<Object> signGet(@RequestBody Map<String, Object> paramsMap) {
        return signService.signGet(paramsMap);
    }

    /**
     * 生成签名 JSON格式的参数
     *
     * @param paramsMap 参数
     * @return ReturnResult<Object>
     */
    @PostMapping("/signPost")
    public ReturnResult<Object> signPost(@RequestBody Map<String, Object> paramsMap) {
        return signService.signPost(paramsMap);
    }
}
